package xyz.zq.sf.common.security.service;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @author hzq
 * @date 2021-02-18 14:44
 */
public class SfUser extends User {

    /*用户id*/
    @Getter
    private Integer id;
    /*用户类型*/
    @Getter
    private Integer userType;
    /*租户id*/
    @Getter
    private Integer tenantId;

    public SfUser(String username, String password, boolean enabled, boolean accountNonExpired,
                  boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities,
                  Integer id, Integer userType, Integer tenantId) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.id = id;
        this.userType = userType;
        this.tenantId = tenantId;
    }

    public SfUser(String username, String password, Collection<? extends GrantedAuthority> authorities,
                  Integer id, Integer userType, Integer tenantId) {
        super(username, password, authorities);
        this.id = id;
        this.userType = userType;
        this.tenantId = tenantId;
    }
}
